const express = require('express');
var bodyParser = require('body-parser')

const app = express()
const port = 3000
app.use(express.static('www'))
////访问上传的文件
app.use('/uploads',express.static('uploads'))


app.use(bodyParser.json({limit:'100mb'}))
const sqlconnnect = require('./sqlconnnect');
//跨域

app.all('*', function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "X-Requested-With");
    res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
    res.header("Access-Control-Allow-Headers", "Content-Type,token");
    next();
});


const wxRouter = require('./wx')
wxRouter(app)

const adminRouter = require('./admin')
adminRouter(app)
app.listen(port,() => {
    console.log(`Expmple app listening on port ${port}`)
})
